import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:lib_util/lib_util.dart';

//常见的列表信息展示组件，左右各有一个text，有一个更多箭头
class TextRow extends StatelessWidget {
  final String leftText;
  String rightText;
  void Function()? onTap;
  bool visibleMore = true; //是否显示更多按钮

  TextRow({Key? key, required this.leftText, this.rightText = "", this.onTap, this.visibleMore = true})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: Container(
        height: 50.w,
        padding: EdgeInsets.fromLTRB(20, 0, 20, 0),
        color: Colors.transparent,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Expanded(
                child: Text(leftText,
                    maxLines: 1, style: TextStyle(fontSize: 14.sp, color: "#333333".toColor(), height: 1))),
            Visibility(
                visible: rightText.isNotEmpty == true,
                child: Container(
                  padding: EdgeInsets.only(left: 5.w, right: 5.w),
                  child: Text(rightText,
                      maxLines: 1, style: TextStyle(fontSize: 14.sp, color: "#BEBDCA".toColor(), height: 1.w)),
                )),
            Visibility(
              visible: visibleMore,
              child: Container(
                child: Image.asset(
                  'assets/images/wallet/token_arrow.png',
                  width: 12.w,
                  height: 12.w,
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}
